package org.pr.kafkaexpress.exception;

/**
 * Kafka自定义异常
 * 
 * @author LXC
 * @since 2025/7/10
 */
public class KafkaException extends RuntimeException {
    
    private final String topic;
    private final String message;
    
    public KafkaException(String message) {
        super(message);
        this.topic = null;
        this.message = message;
    }
    
    public KafkaException(String message, Throwable cause) {
        super(message, cause);
        this.topic = null;
        this.message = message;
    }
    
    public KafkaException(String topic, String message, Throwable cause) {
        super(String.format("Failed to process message for topic '%s': %s", topic, message), cause);
        this.topic = topic;
        this.message = message;
    }
    
    public String getTopic() {
        return topic;
    }
    
    public String getKafkaMessage() {
        return message;
    }
} 